//
//  WmcUploadProtocol.swift
//  YPWatermarkCamera
//
//  Created by 赵新 on 2022/5/27.
//

import UIKit
import YPNetwork

// MARK: - [WmcUploadFileModel]

/// 上传协议
public struct WmcUploadFileModel: YPNetworkJsonProtocol {
    // Lifecycle

    public init() {}

    // Public

    /// 入口场景id
    public var entryId: Int?

    /// 资源类型，0:图片，1视频，2音频
    public var type: Int?

    /// 文件格式名
    public var format: String?

    /// 拍摄时间
    public var takeTime: String?

    /// 城市
    public var city: String?

    /// 地址详情
    public var address: String?

    /// 水印类型，音频可以为空
    public var wmId: Int?

    /// 水印相关扩展信息，音频可以为空
    public var wmcInfo: [String: Any]?

    /// 鱼泡uid
    public var uid: Int?

    /// http上传方式，0: put，1: post，默认是0
    public var httpMethod: Int?
}

// MARK: - [WmcUploadStatus]

public enum WmcUploadStatus: Int {
    /// 还没开始上传
    case none
    /// 上传中
    case uploading
    /// 上传完成
    case completion
    /// 上传失败
    case failure
    /// 取消上传
    case cancel
}

// MARK: - [WmcUploadMultiFileProtocol]

public protocol WmcUploadMultiFileProtocol {
    /// 文件路径
    var fileURL: URL? { get set }

    /// 申请上传的参数
    var params: WmcUploadFileModel? { get set }

    /// 取消上传，主动调用
    var cancel: (() -> Void)? { get set }

    /**
     以下方法是监听回调
     */

    /// 上传状态
    var uploadStatus: ((WmcUploadStatus) -> Void)? { get set }

    /// 上传进度
    var progress: ((Double) -> Void)? { get set }

    /// 上传结果
    var uploadResult: ((WmcMediaUploadResourceModel) -> Void)? { get set }
}
